package com.linkoog.devtools.code_generator.setting.configurable.ui.variable;

import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode;

/**
 * SampleDemoGenerator<br>
 * 生成SampleModel用于页面展示
 *
 * @author fox
 */
public class DefaultVariable {

    public static DefaultMutableTreeTableNode getDefaultVariableTreeTableNode() {
        DefaultMutableTreeTableNode root = new DefaultMutableTreeTableNode(new VariableModel("根"));

        /* 共享参数 */
        VariableModel authorModel = new VariableModel("代码编辑作者", "author", "String", "系统的登录用户", "允许通过配置修改");
        root.add(new DefaultMutableTreeTableNode(authorModel));

        VariableModel dateModel = new VariableModel("当前时间", "date", "Date", null, "当前时间：yyyy-MM-dd HH:mm:ss");
        root.add(new DefaultMutableTreeTableNode(dateModel));

        VariableModel remarkModel = new VariableModel("代码备注", "remark", "String", null, "代码备注");
        root.add(new DefaultMutableTreeTableNode(remarkModel));


        /* 表结构 */
        DefaultMutableTreeTableNode tableNode = new DefaultMutableTreeTableNode(new VariableModel("表结构", "table", "table", null, "表结构"));
        root.add(tableNode);

        VariableModel tableNameModel = new VariableModel("表名", "tableName", "String", null, "表名");
        tableNode.add(new DefaultMutableTreeTableNode(tableNameModel));

        VariableModel tableRemarkModel = new VariableModel("表备注", "tableComment", "String", null, "表备注");
        tableNode.add(new DefaultMutableTreeTableNode(tableRemarkModel));

        VariableModel javaEntityNameModel = new VariableModel("Java类名", "javaEntityName", "String", null, "Java类名");
        tableNode.add(new DefaultMutableTreeTableNode(javaEntityNameModel));


        /* 表结构对应字段配置 */
        DefaultMutableTreeTableNode columnsModel = new DefaultMutableTreeTableNode(new VariableModel("表的所有列", "columns", "List", null, "表对应的所有字段列表"));
        tableNode.add(columnsModel);

        VariableModel columnNameColumnModel = new VariableModel("列名", "columnName", "String", null, "列名");
        columnsModel.add(new DefaultMutableTreeTableNode(columnNameColumnModel));

        VariableModel columnTypeColumnModel = new VariableModel("列的类型", "columnType", "String", null, "列的类型：varchar(20)");
        columnsModel.add(new DefaultMutableTreeTableNode(columnTypeColumnModel));

        VariableModel columnDataTypeColumnModel = new VariableModel("列的数据类型", "columnDataType", "String", null, "列的数据类型：varchar");
        columnsModel.add(new DefaultMutableTreeTableNode(columnDataTypeColumnModel));

        VariableModel pkColumnModel = new VariableModel("是否主键", "columnKey", "String", null, "该字段是否主键：是，否");
        columnsModel.add(new DefaultMutableTreeTableNode(pkColumnModel));

        VariableModel remarksColumnModel = new VariableModel("列的注释", "columnComment", "String", null, "列的注释");
        columnsModel.add(new DefaultMutableTreeTableNode(remarksColumnModel));

        VariableModel javaFieldNameColumnModel = new VariableModel("Java名称", "javaFieldName", "String", null, "Java的属性字段名称");
        columnsModel.add(new DefaultMutableTreeTableNode(javaFieldNameColumnModel));

        VariableModel javaFieldTypeColumnModel = new VariableModel("Java类型", "javaFieldType", "String", null, "Java的属性字段，所对应的类型");
        columnsModel.add(new DefaultMutableTreeTableNode(javaFieldTypeColumnModel));

        VariableModel queryCheckedColumnModel = new VariableModel("是否查询字段", "queryChecked", "Boolean", null, "查询时，是否为条件字段");
        columnsModel.add(new DefaultMutableTreeTableNode(queryCheckedColumnModel));

        VariableModel insertCheckedColumnModel = new VariableModel("是否新增字段", "insertChecked", "Boolean", null, "新增时，是否为必填的字段");
        columnsModel.add(new DefaultMutableTreeTableNode(insertCheckedColumnModel));

        VariableModel dictCheckedColumnModel = new VariableModel("是否字典字段", "dictChecked", "Boolean", null, "是否为字典字段");
        columnsModel.add(new DefaultMutableTreeTableNode(dictCheckedColumnModel));

        VariableModel checkedColumnModel = new VariableModel("是否勾选字段", "checked", "Boolean", null, "字段是否选择");
        columnsModel.add(new DefaultMutableTreeTableNode(checkedColumnModel));

        return root;
    }


}
